<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>

<@head>
<#--<link rel="stylesheet" href="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.css"/>-->
<#--<link rel="stylesheet" href="/misc/app/jq-liandong/area.css"/>-->
<style type="text/css">
    .ci{float: left;padding:7px 0 0 5px}
    .over_box{padding-top: 5px;overflow: hidden;zoom: 1;}
    .over_radio{float: left;margin:10px 5px 0 5px !important;}
    .over_text{width:90px;float: left;}
</style>
</@head>

<@body>
<#--<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/moment.min.js"></script>-->
<#--<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.js"></script>-->
<script src="/misc/app/js/salesman_payrule_detail.js"></script>
<#--<script src="/misc/app/jq-liandong/cityJson.js"></script>-->
<#--<script src="/misc/app/jq-liandong/citySet.js"></script>-->
<#--<script src="/misc/app/jq-liandong/Popt.js"></script>-->
<script>var PicDomain = "${PicDomain!}"</script>
</@body>

<@layout_default>

<div class="box" name="md_add_activity">
    <div class="box-header">
        <!--<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
        </button>-->
        <h4 class="modal-title"><i class="fa fa-plus"></i> 查看规则</h4>
    </div>
    <div class="box-body">
        <form class="form-horizontal" name="form_new_payrule">
            <input type="hidden" name="id" id="hidden_id" value="${payrule.id!}">
            <div class="form-group">
                <label class="col-sm-2 control-label" name="namelabel">规则名称</label>
                <div class="col-sm-10" style="width:50%;height:27px;padding-top:7.5px;">
                    ${payrule.name!}
                    <#--<input type="text" class="form-control" style="width:300px;" placeholder="规则名称" name="name" maxlength="200" />-->
                </div>
            </div>

            <#if (payrule.areaList?size>0)>
                <#list payrule.areaList as item2>
                  <#if item2_index == 0>
                      <div class="form-group area_div" id="regionDiv">
                          <label class="col-sm-2 control-label">适用区域</label>
                          <div class="col-sm-10" style="width:50%;height:27px;padding-top:7.5px;">
                             ${item2.adname!}
                                 <button type="button" class="btn btn-default" data-toggle="modal" data-code="${item2.adcode!}"
                                         data-target="#pro_area_modals"><i class="glyphicon glyphicon-info-sign"></i> 查看适用区域产品详情
                                 </button>
                                 <#--<a href="javascript:void(0);" class="pro_area_detail" data-code="${item2.adcode}"  data-target="#pro_area_modals"><i class="glyphicon glyphicon-info-sign"></i> 查看适用区域产品详情</a>-->
                          </div>
                      </div>
                  <#else>
                      <div class="form-group area_div">
                          <label class="col-sm-2 control-label"></label>
                          <div class="col-sm-10" style="width:50%;height:27px;padding-top:7.5px;">
                            ${item2.adname!}
                                <button type="button" class="btn btn-default" data-toggle="modal" data-code="${item2.adcode!}"
                                        data-target="#pro_area_modals"><i class="glyphicon glyphicon-info-sign"></i> 查看适用区域产品详情
                                </button>

                          </div>
                      </div>
                  </#if>

                </#list>
            </#if>


            <div class="form-group">
                <label class="col-sm-2 control-label">有效时间</label>
                <div class="col-sm-10" style="width:50%;height:27px;padding-top:7.5px;">
                    <#if payrule.valid_begin_time?exists>
                        ${payrule.valid_begin_time?number_to_date?string("yyyy-MM-dd HH:mm:ss")}
                    </#if>
                    <#if payrule.valid_end_time?exists>
                        至 ${payrule.valid_end_time?number_to_date?string("yyyy-MM-dd HH:mm:ss")}
                    </#if>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">支付方式</label>
                <div class="col-sm-5" style="padding-top:7px;">
                    <input type="radio" name="payway" id="radio_yes" value="1" runat="server" checked />手动提现&nbsp;&nbsp;&nbsp;&nbsp;
                <#--<input type="radio" name="payway" id="radio_no" value="2" runat="server"  />自动支付-->
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" name="namelabel">每日提现次数</label>
                <div class="col-sm-10" style="width:50%;height:27px;padding-top:7.5px;">
                    ${payrule.day_limit!}次
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">提现条件</label>
                <div class="col-sm-10 over_box">
                    <div class="left">
                        <#if payrule.pay_condition?exists>
                            <#if payrule.pay_condition == 1>
                                <input type="radio" name="pay_condition" value="1" runat="server" class="over_radio" checked/><span style="float: left;padding:7px 5px 0 0">按瓶数</span>
                                <input type="text" class="form-control over_text" id="by_bing" value="${payrule.pay_limit!}" maxlength="10" readonly="readonly" />
                            </#if>
                            <#if payrule.pay_condition == 2>
                                <input type="radio" name="pay_condition"  value="2" runat="server" class="over_radio"  checked/><span style="float: left;padding:7px 5px 0 0">按金额</span>
                                <input type="text" class="form-control over_text"  id="by_price" value="${payrule.pay_limit!}" maxlength="10" readonly="readonly"/>
                            </#if>

                        </#if>

                    </div>

                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">产品</label>
                <div class="col-sm-10">
                    <table class="table table-striped table-hover">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>产品名称</th>
                            <th>产品编号</th>
                            <th>每瓶费用</th>
                        </tr>
                        </thead>
                        <tbody id="product_table">
                            <#if payrule.proList?exists>
                                <#list payrule.proList as item1>
                                <tr>
                                    <td>${item1.proId!}</td>
                                    <td>${item1.proName!}</td>
                                    <td>${item1.proNumber!}</td>
                                    <td>${item1.price?string('0.00')}</td>
                                </tr>
                                </#list>
                            </#if>
                        </tbody>
                    </table>
                </div>
            </div>

            <#--<div class="form-group" id="selectedProDiv">-->
                <#--<label class="col-sm-2 control-label"></label>-->
               <#---->
            <#--</div>-->
        </form>

    </div>
    <div class="box-footer text-center">
        <button type="button" class="btn btn-default" name="btn_cancel" id="btn_return" onclick="history.go(-1)">返回</button>
    </div>
</div>

<!--===========Modals  点击“查看适用区域产品详情”按钮，显示列表   start================--->
<div class="modal" id="pro_area_modals" tabindex="-1">
    <div class="modal-dialog" role="document" style="width:700px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h5 class="modal-title"><i class="fa fa-plus"></i> 查看详情适用区域</h5>
            </div>
            <form class="form-inline" action="">
                <input type="hidden" id="adcode">
                <div class="input-group"></div>
                <div class="input-group">
                    <input type="text" class="form-control" style="width: 150px" name="prodct" id="prodct" value="${prodct!}"
                           placeholder="产品名称或编号"/>
                </div>
                <div class="input-group">
                    <input type="text" class="form-control" style="width: 100px" name="area" id="area" value="${area!}"
                           placeholder="区域"/>
                </div>
                <div class="input-group">
                    <select class="form-control" name="state" id="state">
                        <option value="-1">状态</option>
                        <option value="0">未启用</option>
                        <option value="1">正常</option>
                        <option value="2">封存</option>
                    </select>
                </div>

                <button type="button" class="btn btn-warning" id="pro_query"><i class="fa fa-search"></i> 查询</button>
            </form>
            <div class="modal-body">
                <table class="table table-striped table-hover">
                    <thead>
                    <tr>

                        <th>区域</th>
                        <th>产品</th>
                        <th>状态</th>
                    </tr>
                    </thead>
                    <tbody id="product_model">

                    </tbody>
                </table>
            </div>
            <div class="box-footer text-center" id="page_model" data-total=""
                 data-size="">
            </div>
            <#--<div class="modal-footer">-->
                <#--<button type="button" class="btn btn-default" data-dismiss="modal" id="selectPro_cancel">取消</button>-->
                <#--<button type="button" class="btn btn-primary" data-dismiss="modal" id="selectPro_confirm">确认</button>-->
            <#--</div>-->
        </div>
    </div>
</div>
<!--===========点击“查看适用区域产品详情”按钮，显示列表   end================--->


</@layout_default>